<%@ page import="ro.gateway.aida.locations.LocationEditorForm"%>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean"%>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html"%>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic"%>
<%@ taglib uri="/WEB-INF/translator.tld" prefix="trans" %>
<%
      LocationEditorForm form = ( LocationEditorForm ) session.getAttribute("loceditorform");
%>
<%
 String ctx = request.getContextPath();
%><head>
      <link rel="stylesheet" href="<html:rewrite page="/alf.css" />

<trans:initPage module="browseloc" />
<html:html>

" type="text/css">
      <script language="javascript">
            function send_message(form, name, value) {
                  form.elements[name].value = value;
                  form.submit();
            }
            function gtwconf(message, url) {
                  if (confirm(message)) {
                        window.location = url;
                  }
            }
      </script>
      <style>
            a.abut {
                  text-decoration:none;
                  color: black;
                  font-weight:normal;
            }
      </style>
	  <link rel="stylesheet" href="/alf.css" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<jsp:include page="../header.jsp" />
      <html:form action="/location/editor">
      <html:hidden property="action" value="" />
      <table width="90%" border="0" align="center" cellpadding="5" cellspacing="1" background=<%=ctx%>/images/pixelbgtable.gif class="text_searchbold">
            <tr>
                  
    <td colspan=2 class="textalb"><trans:showPageMessage label="browseloc.locationmanager" /></td></tr>

            <tr bgcolor="#FFFFFF">
            <td width="30%" align="right" valign="top">
            1. <trans:showPageMessage label="browseloc.cregions" />:
            </td>
            <td align="left" width="70%" valign="top">
            <html:select property="cregion_id"
                  onchange="javascript:send_message(this.form, 'action', 'chgcregion');" >
                  <html:option value="-1"><trans:showPageMessage label="browseloc.nocregion" hide_link="true"/></html:option>
                  <logic:present name="loceditorform" property="cregions">
                        <html:options collection="cregions"
                              property="id"
                              labelProperty="listname" />
                  </logic:present>
            </html:select>
            <br/>
            - <a class="abut" href="edit_location.do?action=create&otype=cregion"><trans:showPageMessage label="browseloc.addawregion" /></a>
            <logic:present name="loceditorform" property="cregion">
                  - <a class="abut" href="javascript:window.location = 'edit_location.do?action=edit&otype=cregion&id=<%=form.cregion_id%>';"><trans:showPageMessage label="browseloc.edthiswregion" /></a>
                  <logic:notPresent name="loceditorform" property="countries">
                  - <a class="abut" href="javascript:gtwconf('Sure?', 'edit_location.do?action=delete&otype=cregion&id=<%=form.cregion_id%>');"><trans:showPageMessage label="browseloc.delthiswregion" /></a>
                  </logic:notPresent>
            </logic:present>
            </td>
            </tr>

            <logic:present name="loceditorform" property="cregion">
                  <tr bgcolor="#FFFFFF">
                  <td width="30%" align="right" valign="top">
                  2. <trans:showPageMessage label="browseloc.country" />:
                  </td>
                  <td align="left" width="70%" valign="top">
                  <html:select property="country_iso3"
                        onchange="javascript:send_message(this.form, 'action', 'chgcountry');">
                        <html:option value="-1"><trans:showPageMessage label="browseloc.nocountry" hide_link="true"/></html:option>
                        <logic:present name="loceditorform" property="countries">
                              <html:options collection="countries"
                                    property="iso3"
                                    labelProperty="name" />
                        </logic:present>
                  </html:select>
                  <br/>
                  - <a class="abut" href="edit_location.do?action=create&otype=country"><trans:showPageMessage label="browseloc.addacountry" /></a>
                  <logic:present name="loceditorform" property="country">
					- <a class="abut" href="javascript:window.location = 'edit_location.do?action=edit&otype=country&id=<%=form.country_iso3%>';"><trans:showPageMessage label="browseloc.edthiscountry" /></a>
                        <logic:notPresent name="loceditorform" property="regions">
					- <a class="abut" href="javascript:gtwconf('Sure?','edit_location.do?action=delete&otype=country&id=<%=form.country_iso3%>');"><trans:showPageMessage label="browseloc.deletethiscountry" /></a>
                        </logic:notPresent>
                  </logic:present>
                  </td>
                  </tr>
            </logic:present>

            <logic:present name="loceditorform" property="country">
                  <tr bgcolor="#FFFFFF">
                  <td width="30%" align="right" valign="top">
                  3. <trans:showPageMessage label="browseloc.region" />:
                  </td>
                  <td align="left" width="70%" valign="top">
                  <html:select property="region_id"
                        onchange="javascript:send_message(this.form, 'action', 'chgregion');">
                        <html:option value="-1"><trans:showPageMessage label="browseloc.noregion" hide_link="true"/></html:option>
                        <logic:present name="loceditorform" property="regions">
                              <html:options collection="regions"
                                    property="id"
                                    labelProperty="name" />
                        </logic:present>
                  </html:select>
                  <br/>
                  - <a class="abut" href="edit_location.do?action=create&otype=region"><trans:showPageMessage label="browseloc.addaregion" /></a>
                  <logic:present name="loceditorform" property="region">
					- <a class="abut" href="javascript:window.location = 'edit_location.do?action=edit&otype=region&id=<%=form.region_id%>';"><trans:showPageMessage label="browseloc.edthisregion" /></a>
                        <logic:notPresent name="loceditorform" property="counties">
					- <a class="abut" href="javascript:gtwconf('Sure?','edit_location.do?action=delete&otype=region&id=<%=form.region_id%>');"><trans:showPageMessage label="browseloc.deletethisregion" /></a>
                        </logic:notPresent>
                  </logic:present>
                  </td>
                  </tr>
            </logic:present>

            <logic:present name="loceditorform" property="region">
                  <tr bgcolor="#FFFFFF">
                  <td width="30%" align="right" valign="top">
                  4. <trans:showPageMessage label="browseloc.county" />:
                  </td>
                  <td align="left" width="70%" valign="top">
                  <html:select property="county_id"
                        onchange="javascript:send_message(this.form, 'action', 'chgcounty');">
                        <html:option value="-1"><trans:showPageMessage label="browseloc.nocounty" hide_link="true"/></html:option>
                        <logic:present name="loceditorform" property="counties">
                              <html:options collection="counties"
                                    property="id"
                                    labelProperty="name" />
                        </logic:present>
                  </html:select>
                  <br/>
                  - <a class="abut" href="edit_location.do?action=create&otype=county"><trans:showPageMessage label="browseloc.addacounty" /></a>
                  <logic:present name="loceditorform" property="county">
					- <a class="abut" href="javascript:window.location = 'edit_location.do?action=edit&otype=county&id=<%=form.county_id%>';"><trans:showPageMessage label="browseloc.edthiscounty" /></a>
                        <logic:notPresent name="loceditorform" property="towns">
					- <a class="abut" href="javascript:gtwconf('Sure?','edit_location.do?action=delete&otype=county&id=<%=form.county_id%>');"><trans:showPageMessage label="browseloc.deletethiscounty" /></a>
                        </logic:notPresent>
                  </logic:present>
                  </td>
                  </tr>
            </logic:present>

            <logic:present name="loceditorform" property="county">
                  <tr bgcolor="#FFFFFF">
                  <td width="30%" align="right" valign="top">
                  5. <trans:showPageMessage label="browseloc.town" />:
                  </td>
                  <td align="left" width="70%" valign="top">
                  <html:select property="town_id"
                        onchange="javascript:send_message(this.form, 'action', 'chgtown');">
                        <html:option value="-1"><trans:showPageMessage label="browseloc.notown" hide_link="true"/></html:option>
                        <logic:present name="loceditorform" property="towns">
                              <html:options collection="towns"
                                    property="sirsup_id"
                                    labelProperty="name" />
                        </logic:present>
                  </html:select>
                  <br/>
                  - <a class="abut" href="edit_location.do?action=create&otype=town"><trans:showPageMessage label="browseloc.addatown" /></a>
                  <logic:present name="loceditorform" property="town">
					- <a class="abut" href="javascript:window.location = 'edit_location.do?action=edit&otype=town&id=<%=form.town_id%>';"><trans:showPageMessage label="browseloc.edthistown" /></a>
                        <logic:notPresent name="loceditorform" property="villages">
					- <a class="abut" href="javascript:gtwconf('Sure?','edit_location.do?action=delete&otype=town&id=<%=form.town_id%>');"><trans:showPageMessage label="browseloc.deletethistown" /></a>
                        </logic:notPresent>
                  </logic:present>
                  </td>
                  </tr>
            </logic:present>


            <logic:present name="loceditorform" property="town">
                  <tr bgcolor="#FFFFFF">
                  <td width="30%" align="right" valign="top">
                  6. <trans:showPageMessage label="browseloc.village" />:
                  </td>
                  <td align="left" width="70%" valign="top">
                  <html:select property="village_id"
                        onchange="javascript:send_message(this.form, 'action', 'chgvillage');">
                        <html:option value="-1"><trans:showPageMessage label="browseloc.novillage" hide_link="true"/></html:option>
                        <logic:present name="loceditorform" property="villages">
                              <html:options collection="villages"
                                    property="siruta_id"
                                    labelProperty="name" />
                        </logic:present>
                  </html:select>
                  <br/>
				- <a class="abut" href="edit_location.do?action=create&otype=village"><trans:showPageMessage label="browseloc.addavillage" /></a> <logic:present name="loceditorform" property="village">
				- <a class="abut" href="javascript:window.location = 'edit_location.do?action=edit&otype=village&id=<%=form.village_id%>';"><trans:showPageMessage label="browseloc.edthisvillage" /></a>
				- <a class="abut" href="javascript:gtwconf('Sure?','edit_location.do?action=delete&otype=village&id=<%=form.village_id%>');"><trans:showPageMessage label="browseloc.deletethisvillage" /></a> </logic:present>
				</td>
                  </tr>
            </logic:present>
      </table><trans:showPageMessage label="translator.showhiddentags"/>
      </html:form>
</body>
<jsp:include page="../footer.jsp" />
</html:html>